Skip to content

Conversation

pascalbaljet
Copy link
Member

Currently, there is no way to reset the <InfiniteScroll> component to the first page, for example, when your filters or search query change. When using Merge Props, you can pass a reset option. With this PR, the <InfiniteScroll> component will respect that option.

The example below, both the paginated users prop, and the state of the <InfiniteScroll> component that uses that prop will be reset.

const form = useForm({
  page: undefined,
  search: '',
})

const performSearch = () => {
  form.get('', {
    preserveState: true,
    replace: true,
    only: ['users'],
    reset: ['users'],
  })
}

Depends on: inertiajs/inertia-laravel#781

@pascalbaljet pascalbaljet merged commit 68085e7 into master Sep 28, 2025
12 checks passed
@pascalbaljet pascalbaljet deleted the reset-scroll-prop branch September 28, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant